Page({
  data:{
    placelist:wx.getStorageSync('placelist'),
    pricelist:wx.getStorageSync('pricelist'),
    itemlist:wx.getStorageSync('itemlist'),
    clickitem:wx.getStorageSync('clickitem'),
    index: '0',
    picker: ['请选择人数','1', '2', '3', '4', '5',],
    total:0,
    sum:0
  },
  onLoad(){
    var total=this.data.total
    this.data.clickitem.forEach(element => {
      total+=parseInt(this.data.pricelist[element])
      this.setData({
        total
      })
    });
  },
  PickerChange(e) {
    console.log(e);
    this.setData({
      index: e.detail.value
    })
    var num=parseInt(e.detail.value)
    var total=parseInt(this.data.total)+200
    this.setData({
      sum:num*total
    })
  },
  tolast(e){
    if (this.data.index=='0') {
      wx.showToast({
        title: '请先选择人数',
        icon:"none"
      })
      return
    }
    console.log(e)
    var price=e.currentTarget.dataset.price
    wx.navigateTo({
      url: '../tjdingzhipaylast/tjdingzhipaylast?price='+price,
    })
  }
})